<?php
	class giohangdb
	{
		public function Them($basketSession = "", $productID = 0, $productPrice = 0)
		{
			$sql = "INSERT INTO baskets(basketSession, productID, productPrice)
					VALUES('$basketSession', '$productID', '$productPrice')";
					
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function LayDanhSach()
		{
			$sql = "SELECT * FROM tbl_sanpham";
			
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
		
		public function Xoa($MaNguoiDung = 0)
		{
			$sql = "DELETE FROM nguoidung WHERE MaNguoiDung = $MaNguoiDung";
			
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function CapNhat($MaNguoiDung = 0, $HoVaTen = "", $NgaySinh = 0, $DienThoai = "", $Email = "", $MatKhau = "")
		{
			$sql = "UPDATE nguoidung SET HoVaTen = '$HoVaTen',
										 NgaySinh = '$NgaySinh',
										 DienThoai = '$DienThoai',
										 Email = '$Email'";
			if($MatKhau != "")
				$sql .= ", MatKhau = '$MatKhau'";
				
			$sql .= " WHERE MaNguoiDung = $MaNguoiDung";
			
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
	}
?>